<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/vue.js"></script>
    <style>
        .ball{
            width: 100px;
            height: 100px;
            background: tomato;
        }
    </style>
</head>
<body>
    <!-- 
        vue中获取DOM元素的步骤
        1、在要操作的DOM元素上定义ref属性
        2、
     -->
    <div id="root">
        <div class="ball" @click="handleClick" ref="ballRef"></div>
    </div>
    <script>
        new Vue({
            el:'#root',
            methods: {
                handleClick(){
                    //不要这样去用
                   this.$refs.ballRef.style.backgroundColor="skyblue"
                }
            },
        })
    </script>
</body>
</html>